package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */
@IdClass(org.gap.domain.RelationsTiersPK.class)
@Entity
@NamedQueries({
		@NamedQuery(name = "findAllRelationsTierss", query = "select myRelationsTiers from RelationsTiers myRelationsTiers"),
		@NamedQuery(name = "findRelationsTiersByPrimaryKey", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltTiersParent = ?1 and myRelationsTiers.rltTiersFils = ?2 and myRelationsTiers.rltRelation = ?3"),
		@NamedQuery(name = "findRelationsTiersByRltDateDebut", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltDateDebut = ?1"),
		@NamedQuery(name = "findRelationsTiersByRltDateDebutAfter", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltDateDebut > ?1"),
		@NamedQuery(name = "findRelationsTiersByRltDateDebutBefore", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltDateDebut < ?1"),
		@NamedQuery(name = "findRelationsTiersByRltDateFin", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltDateFin = ?1"),
		@NamedQuery(name = "findRelationsTiersByRltDateFinAfter", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltDateFin > ?1"),
		@NamedQuery(name = "findRelationsTiersByRltDateFinBefore", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltDateFin < ?1"),
		@NamedQuery(name = "findRelationsTiersByRltRelation", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltRelation = ?1"),
		@NamedQuery(name = "findRelationsTiersByRltRelationContaining", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltRelation like ?1"),
		@NamedQuery(name = "findRelationsTiersByRltSens", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltSens = ?1"),
		@NamedQuery(name = "findRelationsTiersByRltSensContaining", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltSens like ?1"),
		@NamedQuery(name = "findRelationsTiersByRltTiersFils", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltTiersFils = ?1"),
		@NamedQuery(name = "findRelationsTiersByRltTiersParent", query = "select myRelationsTiers from RelationsTiers myRelationsTiers where myRelationsTiers.rltTiersParent = ?1") })
@Table(schema = "GAP", name = "RELATIONS_TIERS")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP_v2/org/gap/domain", name = "RelationsTiers")
public class RelationsTiers implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "RLT_TIERS_PARENT", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer rltTiersParent;
	/**
	 */

	@Column(name = "RLT_TIERS_FILS", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer rltTiersFils;
	/**
	 */

	@Column(name = "RLT_RELATION", length = 3, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String rltRelation;
	/**
	 */

	@Column(name = "RLT_SENS", length = 1)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String rltSens;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "RLT_DATE_DEBUT")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar rltDateDebut;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "RLT_DATE_FIN")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar rltDateFin;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "RLT_TIERS_FILS", referencedColumnName = "TIE_TIERS", nullable = false, insertable = false, updatable = false) })
	@XmlTransient
	Tiers tiersByRltTiersFils;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "RLT_RELATION", referencedColumnName = "REL_RELATION", nullable = false, insertable = false, updatable = false) })
	@XmlTransient
	Relations relations;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "RLT_TIERS_PARENT", referencedColumnName = "TIE_TIERS", nullable = false, insertable = false, updatable = false) })
	@XmlTransient
	Tiers tiersByRltTiersParent;

	/**
	 */
	public void setRltTiersParent(Integer rltTiersParent) {
		this.rltTiersParent = rltTiersParent;
	}

	/**
	 */
	public Integer getRltTiersParent() {
		return this.rltTiersParent;
	}

	/**
	 */
	public void setRltTiersFils(Integer rltTiersFils) {
		this.rltTiersFils = rltTiersFils;
	}

	/**
	 */
	public Integer getRltTiersFils() {
		return this.rltTiersFils;
	}

	/**
	 */
	public void setRltRelation(String rltRelation) {
		this.rltRelation = rltRelation;
	}

	/**
	 */
	public String getRltRelation() {
		return this.rltRelation;
	}

	/**
	 */
	public void setRltSens(String rltSens) {
		this.rltSens = rltSens;
	}

	/**
	 */
	public String getRltSens() {
		return this.rltSens;
	}

	/**
	 */
	public void setRltDateDebut(Calendar rltDateDebut) {
		this.rltDateDebut = rltDateDebut;
	}

	/**
	 */
	public Calendar getRltDateDebut() {
		return this.rltDateDebut;
	}

	/**
	 */
	public void setRltDateFin(Calendar rltDateFin) {
		this.rltDateFin = rltDateFin;
	}

	/**
	 */
	public Calendar getRltDateFin() {
		return this.rltDateFin;
	}

	/**
	 */
	public void setTiersByRltTiersFils(Tiers tiersByRltTiersFils) {
		this.tiersByRltTiersFils = tiersByRltTiersFils;
	}

	/**
	 */
	public Tiers getTiersByRltTiersFils() {
		return tiersByRltTiersFils;
	}

	/**
	 */
	public void setRelations(Relations relations) {
		this.relations = relations;
	}

	/**
	 */
	public Relations getRelations() {
		return relations;
	}

	/**
	 */
	public void setTiersByRltTiersParent(Tiers tiersByRltTiersParent) {
		this.tiersByRltTiersParent = tiersByRltTiersParent;
	}

	/**
	 */
	public Tiers getTiersByRltTiersParent() {
		return tiersByRltTiersParent;
	}

	/**
	 */
	public RelationsTiers() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(RelationsTiers that) {
		setRltTiersParent(that.getRltTiersParent());
		setRltTiersFils(that.getRltTiersFils());
		setRltRelation(that.getRltRelation());
		setRltSens(that.getRltSens());
		setRltDateDebut(that.getRltDateDebut());
		setRltDateFin(that.getRltDateFin());
		setTiersByRltTiersFils(that.getTiersByRltTiersFils());
		setRelations(that.getRelations());
		setTiersByRltTiersParent(that.getTiersByRltTiersParent());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("rltTiersParent=[").append(rltTiersParent).append("] ");
		buffer.append("rltTiersFils=[").append(rltTiersFils).append("] ");
		buffer.append("rltRelation=[").append(rltRelation).append("] ");
		buffer.append("rltSens=[").append(rltSens).append("] ");
		buffer.append("rltDateDebut=[").append(rltDateDebut).append("] ");
		buffer.append("rltDateFin=[").append(rltDateFin).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((rltTiersParent == null) ? 0 : rltTiersParent.hashCode()));
		result = (int) (prime * result + ((rltTiersFils == null) ? 0 : rltTiersFils.hashCode()));
		result = (int) (prime * result + ((rltRelation == null) ? 0 : rltRelation.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof RelationsTiers))
			return false;
		RelationsTiers equalCheck = (RelationsTiers) obj;
		if ((rltTiersParent == null && equalCheck.rltTiersParent != null) || (rltTiersParent != null && equalCheck.rltTiersParent == null))
			return false;
		if (rltTiersParent != null && !rltTiersParent.equals(equalCheck.rltTiersParent))
			return false;
		if ((rltTiersFils == null && equalCheck.rltTiersFils != null) || (rltTiersFils != null && equalCheck.rltTiersFils == null))
			return false;
		if (rltTiersFils != null && !rltTiersFils.equals(equalCheck.rltTiersFils))
			return false;
		if ((rltRelation == null && equalCheck.rltRelation != null) || (rltRelation != null && equalCheck.rltRelation == null))
			return false;
		if (rltRelation != null && !rltRelation.equals(equalCheck.rltRelation))
			return false;
		return true;
	}
}
